<?php

declare(strict_types=1);

namespace App\Command;

use App\Annotation\OperationLog;
use App\Dao\UserDao;
use App\Model\NoticeCooperative;
use App\Model\NoticeEmployer;
use App\Model\NoticeUser;
use App\Model\User;
use App\Service\Admin\AdminRoleService;
use App\Service\Admin\AdminUserService;
use App\Service\Admin\CooperativeService;
use App\Utils\Log;
use App\Utils\Notice\Sender;
use App\Utils\Notice\UserTaskNotAuditNotice;
use App\Utils\Wechat\OpenPlatform\OpenPlatform;
use Hyperf\Command\Command as HyperfCommand;
use Hyperf\Command\Annotation\Command;
use Hyperf\Di\Annotation\AnnotationCollector;
use Hyperf\Di\Annotation\Inject;
use Psr\Container\ContainerInterface;

/**
 * @Command
 */
class CreateAdminUser extends HyperfCommand
{
    /**
     * @var ContainerInterface
     */
    protected $container;

    /**
     * @Inject()
     * @var AdminUserService
     */
    protected $adminUserService;

    /**
     * @Inject()
     * @var AdminRoleService
     */
    protected $adminRoleService;

    public function __construct(ContainerInterface $container)
    {
        $this->container = $container;

        parent::__construct('CreateAdminUser');
    }

    public function configure()
    {
        parent::configure();
        $this->setDescription('Hyperf Demo Command');
    }

    public function handle()
    {

        $this->adminRoleService->save(
            0,[
                'name'=>'管理员',
                'remark'=> '管理所有'
            ]
        );

        $this->adminUserService->save(0,[
            'username' =>'admin',
            'mobile' => 17727696932,
            'password' => 123456,
            'role_id' => 1
        ]);

    }
}
